feat(tui): warn when a proposed endpoint is not method- and path-scoped - #2938
Open
vyncint wants to merge 1 commit into
Open
feat(tui): warn when a proposed endpoint is not method- and path-scoped#2938vyncint wants to merge 1 commit into
vyncint wants to merge 1 commit into
Conversation
The draft inbox renders an endpoint's scope but never says when that scope is wide. endpoint_layer_label already tags L4 and format_allow_rule already renders an unset method or path as *, so the breadth is displayed while nothing draws a reviewer's eye to a proposal that grants far more than the request that was denied. Add scope_warning, a pure classifier beside endpoint_layer_label, and render it under the endpoint it describes in the detail popup, styled like the existing security-note line. It flags an L4 endpoint, a REST endpoint with no allow rules, and a REST allow rule that leaves the method or path unset. Protocols other than REST scope on command rather than method and path, so they are left alone rather than warned about incorrectly. This stays in the TUI rather than in generate_security_notes because the gateway's security notes feed auto-approval eligibility, so adding a case there is a policy decision rather than a presentation one. Everything needed to classify the endpoint is already on the client in proposed_rule.endpoints. Part of NVIDIA#1098. Signed-off-by: Vyncint Ng <115854244+vyncint@users.noreply.github.com>
vyncint
requested review from
a team,
derekwaynecarr,
mrunalp and
sjenning
as code owners
August 25, 2026 23:53
7 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
The draft inbox renders an endpoint's scope but never says when that scope is wide. An
L4tag or anallow * *is displayed exactly like a tightly scoped rule, so a reviewer approving quickly has nothing drawing their eye to a proposal that grants far more than the request that was denied. This adds a warning under the offending endpoint in the detail popup.Related Issue
Part of #1098 — Definition of Done item "TUI shows an explicit L4/no-method-path scoping warning when applicable."
Not
Fixes/Closes: this completes one of the seven DoD items. #2908 completed the rejected-guidance item; the remaining gaps arehuman_summaryas the headline, which needs a proto field or a decision to fall back torule_name.While checking what was left I found that the
intent_summaryitem already appears satisfied:crates/openshell-supervisor-network/src/policy_local.rs:1050setsrationale: intent_summary, and the popup has renderedRationale:for some time. That box looks tickable without code — flagging rather than assuming.Changes
All in
crates/openshell-tui/src/ui/sandbox_draft.rs(+144, −0):scope_warning(&NetworkEndpoint) -> Option<&'static str>— a pure classifier next toendpoint_layer_label, which already carries the L4 test.It flags three cases:
protocolempty (L4)format_allow_rulealready renders these as*, but nothing flagged themProtocols other than REST scope on
commandrather than method and path, so they are deliberately left alone rather than warned about incorrectly.This surfaces guidance the project already gives rather than inventing a rule:
docs/sandboxes/policy-advisor.mdxsays "For REST APIs, prefer L7 rules over broad L4 access. A good proposal allows one method and the smallest safe path." The same page notes the mechanistic mapper drafts an L4 endpoint whenever no L7 samples are available, so broad proposals arrive by normal means and are worth flagging at review time. The wording is descriptive rather than an error.Why the TUI and not the gateway
generate_security_notes(crates/openshell-server/src/grpc/policy.rs:5897) flags uninspected credentials, internal destinations, wildcard hosts, private and hostlessallowed_ips, and well-known database ports — but nothing about L4 breadth or a missing method/path. Adding it there would change what the prover-adjacent notes mean and would affect auto-approval eligibility, which is a policy decision rather than a presentation one. Everything needed to classify this is already inproposed_rule.endpointson the client, so this stays presentation-only. Happy to move it server-side if you would rather it be part of the security notes.Testing
mise run pre-commitpassesopenshell-tui, which has no e2e surfacemise run cicargo test -p openshell-tuiEight new tests: five on the classifier (L4, REST without rules, unset method, unset path, fully scoped, non-REST left alone) and two render tests at 80×24 asserting the warning appears for an L4 endpoint and is absent for a scoped one.
Checklist
Neighbours checked
#2935 is open on
docs/sandboxes/policy-advisor.mdxas well, but its hunks are at lines 131 and 172 while this adds at 216, and it touches noopenshell-tuifile. Itsadvisor_proposedprovenance change does not affect this classifier, which reads onlyprotocolandrules. #2168 remains a stale draft insandbox_draft.rs; nothing here touchesapproval_annotationorvalidation_issue_summary.